<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
	<c:if test="${ empty title }">
		<c:set scope="request" var="title" value="用户管理"></c:set>
	</c:if>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>${ title }</title>
    <base href="${ pageContext.servletContext.contextPath }/">
    <link rel="icon" href="statics/img/favicon.svg" sizes="any" type="image/svg+xml">
    <link rel="stylesheet" href="statics/css/base.css">
    <link rel="stylesheet" href="statics/css/manager.css">
</head>
<body>
	<%@include file="/pages/common/header.jsp"%>
	<main>
		<section class="table-header flex">
			<p class="flex-1 flex-center color-danger">${ order_message }</p>
			<c:remove var="order_message"></c:remove>
			<ul>
				<li><a href="order${ title == '我的订单' ? '/all' : '' }">${ title == '我的订单' ? '全部' : '我的' }订单</a></li>
				<li><a href="manager/book">图书管理</a></li>
			</ul>
		</section>
		<section class="table-container">
			<table>
		     	<thead>
		     		<tr>
			      		<td>用户ID</td>
			      		<td>用户名</td>
			      		<td>年龄</td>
			      		<td>性别</td>
			      		<td>邮箱</td>
			      		<td>注册时间</td>
			      		<td>操作</td>
			      	</tr>
		     	</thead>
		     	<tbody>
			      	<c:forEach items="${ userList }" var="user">
			      	<tr>
			      		<th>${ user.id }</th>
			      		<td>${ user.username }</td>
			      		<td>${ user.age == 0 ? '保密' : user.age }</td>
			      		<td>${ user.gender == 0 ? '男' : '女' }</td>
			      		<td>${ user.email }</td>
			      		<td><fmt:formatDate value="${ user.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			      		<td>
			      			<a href="user/detail?id=${ user.id }" class="btn btn-primary">修改</a>
			      			<a href="manager/user/delete?id=${ user.id }" class="btn btn-danger">删除</a>
			      		</td>
			      	</tr>
			      	</c:forEach>
		     	</tbody>
			</table>
		</section>
		<%@include file="/pages/common/pagination.jsp" %>
	</main>
	<%@include file="/pages/common/footer.jsp" %>
</body>
</html>